
fn other_fun(){
    println!("this is function");
}

//参数必须指定类型
fn other_fun1(a:i8,b:u32){
    println!("a = {},b = {}",a,b);
}

//返回值,方式1
fn other_fun2(a:i8,b:i8)->i8{
    return a+b;
}

fn other_fun3(a:i8,b:i8)->i8{
    a+b
}

fn main() {
    other_fun();

    other_fun1(1,2);

    let r = other_fun2(1,2);
    println!("r = {}",r);

    let r1 = other_fun3(1,2);
    println!("r1 = {}",r1);

    //语句是执行一些操作，但不会返回值的指令
    //错误示例
    // let y = (let x = 3);

    //表达式会计算一些值
    let y = {
        let x = 3;
        x + 5
    };

    println!("y = {}",y);

    println!("Hello, world!");
}
